<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../../../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<title></title>
		<style>
			.mui-table-view::before,.mui-table-view::after,.mui-table-view-cell::after{
				background: none;
			}
		</style>
	</head>
	<body class="bg-white">
		<div class="container" id="container">
		  <header class="mui-bar mui-bar-nav">
		      <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		      <h1 class="mui-title">项目入场</h1>
		  </header>
		  <div id="" class="mui-content bg-white">
			  <ul class="mui-table-view">
				  <li class="mui-table-view-cell mui-card mui-media" id="notice">
					  <a href="javascript:;">
						  <img class="mui-media-object mui-pull-right" src="../img/notice.png">
						  <div class="mui-media-body">
							  入场须知
							  <p class='mui-ellipsis'>项目入场必须签写《入场须知》</p>
						  </div>
					  </a>
				  </li>
				  <li class="mui-table-view-cell mui-card mui-media" id="record">
					  <a href="javascript:;">
						  <img class="mui-media-object mui-pull-right" src="../img/record.png">
						  <div class="mui-media-body">
							  登记记录
							  <p class='mui-ellipsis'>项目入场登记记录</p>
						  </div>
					  </a>
				  </li>
			  </ul>
		  </div>
		</div>
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/jquery-1.7.2.min.js"></script>
		<script src="../js/mkeyplus.base.js"></script>
		<script src="../formal/js/api.js"></script>
		<script src="js/home.js"></script>
		<script>
			var hasExam = false
			mui.plusReady(function(){
				var htapi = new HTGlobal();
				var user = htapi.getOsUser()
				if(user){
					htapi.fetch({
					  projectId: user.currentProjectId,
					  appUserId: user.id,
					}, function(data) {
						var D = data.data || []
						if(Array.isArray(D) && D.length>0){
							hasExam = true
						}
					}, false, 'exam')
				}
			})
			$('#record').on('tap', function() {
				//登记记录
			  var action = function(){
				  if(!hasExam){
				  	mui.toast('关联项目下未有对应的考试内容，请联系场站负责人！');
				  	return;
				  }
				  mui.openWindow({
				    url: '../record/index.html',
				    id: '../record/index.html',
				    extras: {},
				    waiting: {
				      autoShow: false
				    }
				  })
			  }
			  unifyfn(action)
			});
			$('#notice').on('tap', function() {
				//入场须知
				unifyfn(function(){
					if(!hasExam){
						mui.toast('关联项目下未有对应的考试内容，请联系场站负责人！');
						return;
					}
					  //打开入场须知
					  var user = localStorage.getItem('outUser'),
					    openPath = '../formal/registration_on.html';
					  //console.log(user);return;
					  if (user) {
					    user = JSON.parse(user);
					    if (user.notice && user.notice != 0) {
					      openPath = './admission.html';
					    }
					  }
					  //console.log(openPath);return;	
					  mui.openWindow({
					    url: openPath,
					    id: openPath,
					    extras: {},
					    waiting: {
					      autoShow: false
					    }
					  })
					
				})
			   
			});
		</script>
	</body>
</html>
